<template>
  <div class="reg_2">
    <div class="immg">
      
      <img
        src="https://ts1.cn.mm.bing.net/th/id/R-C.61e900aea477f3f2b30585ef8db329b6?rik=IHoIaibaTjLBZQ&riu=http%3a%2f%2fpic.616pic.com%2fys_img%2f00%2f58%2f28%2fA1lMAEemor.jpg&ehk=XMZNRZ3j4C7k8nWeEcxiJTFeueCnpd564YlTHJ%2bSw44%3d&risl=&pid=ImgRaw&r=0"
        alt
      />
      <div style="font-size:12px;text-align:center">请设置登录密码</div>
      
    </div>
    <div class="input_">
      <el-input placeholder="请设置至少6位登录密码" v-model="input1" show-password class="elinput"></el-input>
      <div style="font-size:12px">密码强度校验,至少6位,包括至少1个大写字母,1个小写字母,1个数字</div>
      <van-button
        round
        type="info"
        color="linear-gradient(to right, #ff6034, #ee0a24)"
        @click="goNext()"
        class="butn"
      >完成</van-button>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      sms: "",
      input1: "Zz23456"
    };
  },
  methods: {
    goNext() {
      let phone = localStorage.getItem("tel");
      let reg = /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{6,}/;

      if (reg.test(this.input1)) {
        // alert("成功！");
        axios({
          url: "http://121.89.205.189:3001/api/user/dofinishregister",
          method: "post",
          data: `tel=${phone}&password=${this.input1}`
        }).then(res => {
          if (res.data.code == 200) {
            // alert("注册成功！");
            // Toast.success('成功文案');
            this.$router.push("/login");
          }
        });
      } else {
        alert("失败");
      }

      // this.$router.push("/login");
    }
  }
};
</script>

<style scoped>
.reg_2 {
  padding: 0.625rem;
}
.immg {
  width: 18.75rem;
  height: 9.375rem;
  margin: 0.625rem auto;
  text-align: center;
}
.send {
  background-color: rgb(222, 203, 206);
  border: none;
  color: red;
  border-radius: 1.25rem;
  width: 5rem;
}

input {
  height: 1.875rem;
  border-radius: 1.25rem;
}
img {
  width: 50%;
  height: 40%;
}
.butn {
  width: 100%;
}
</style>